package xyj.sparrow.scheduler.util;

import lombok.extern.slf4j.Slf4j;
import xyj.sparrow.scheduler.cron.CronExpression;


/**
 * CRON表达式工具类
 *
 * @author 江南小俊
 * @since 2021/6/14 上午11:17
 **/
@Slf4j
public class CronUtil {
    /**
     * 验证Cron表达式是否正确
     *
     * @param cronStr
     * @return
     */
    public static boolean verify(String cronStr) {
        try {
            new CronExpression(cronStr, "default");
        } catch (Exception e) {
            log.error("", e);
            return false;
        }
        return true;
    }
}
